@trycourier/react-designer 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,21 +5,13 @@ Courier Create is a package designed to facilitate the editing of templates in a
5
5
  ## Key Features
6
6
 
7
7
  - **Embedded React Integration**
8
-
9
- Easily integrate the template editor directly into your existing React application.
10
-
8
+ Easily integrate the template editor directly into your existing React application.
11
9
  - **Multi-Tenant Support**
12
-
13
- Seamlessly manage and edit templates for different tenants, each with their own branding.
14
-
10
+ Seamlessly manage and edit templates for different tenants, each with their own branding.
15
11
  - **Brand Editing**
16
-
17
- Customize branding elements such as logos, colors, and styles per tenant to ensure consistency with each client's identity.
18
-
12
+ Customize branding elements such as logos, colors, and styles per tenant to ensure consistency with each client's identity.
19
13
  - **Developer Friendly**
20
-
21
- Designed with intuitive APIs and flexible components to speed up development and integration.
22
-
14
+ Designed with intuitive APIs and flexible components to speed up development and integration.
23
15
 
24
16
  # Getting Started
25
17
 
@@ -121,7 +113,7 @@ As template changes are made, they are automatically saved to Courier.
121
113
 
122
114
  ```tsx
123
115
  import "@trycourier/react-designer/styles.css";
124
- import { TemplateEditor, TemplateProvider } from '@trycourier/react-designer';
116
+ import { TemplateEditor, TemplateProvider } from "@trycourier/react-designer";
125
117
 
126
118
  function App() {
127
119
  return (
@@ -136,24 +128,32 @@ function App() {
136
128
 
137
129
  By default, the Courier template editor exposes a publish button that the template editor can interact with after completing changes. To override this default publishing behavior, you can hide the publishing button and interact with the publishing action directly allowing you to tightly integrate with your application's workflow.
138
130
 
139
- *Note:* `useTemplateActions` *must be used inside of the `<TemplateProvider />` context*
131
+ _Note:_ `useTemplateActions` _must be used inside of the `<TemplateProvider />` context_
140
132
 
141
133
  ```tsx
142
134
  import "@trycourier/react-designer/styles.css";
143
- import { TemplateEditor, TemplateProvider, useTemplateActions } from '@trycourier/react-designer';
135
+ import { TemplateEditor, TemplateProvider, useTemplateActions } from "@trycourier/react-designer";
144
136
 
145
137
  function SaveButtonComponent() {
146
138
  const { publishTemplate } = useTemplateActions();
147
-
148
- const handlePublishTemplate = () => {
149
- //... other publish logic
150
- await publishTemplate();
151
- }
139
+
140
+ const handlePublishTemplate = async () => {
141
+ //... other publish logic
142
+ await publishTemplate();
143
+ };
152
144
 
153
145
  return (
154
- <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
146
+ <div>
155
147
  <TemplateEditor hidePublish />
156
- <button onClick={handlePublishTemplate}>Save Template</button>;
148
+ <button onClick={handlePublishTemplate}>Save Template</button>
149
+ </div>
150
+ );
151
+ }
152
+
153
+ function App() {
154
+ return (
155
+ <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
156
+ <SaveButtonComponent />
157
157
  </TemplateProvider>
158
158
  );
159
159
  }
@@ -165,32 +165,32 @@ You can customize the look and feel through the theming API, which allows you to
165
165
 
166
166
  ```tsx
167
167
  import "@trycourier/react-designer/styles.css";
168
- import { TemplateEditor } from '@trycourier/react-designer';
168
+ import { TemplateEditor } from "@trycourier/react-designer";
169
169
 
170
170
  function App() {
171
171
  return (
172
172
  <TemplateEditor
173
173
  theme={{
174
- background: '#ffffff',
175
- foreground: '#292929',
176
- muted: '#D9D9D9',
177
- mutedForeground: '#A3A3A3',
178
- popover: '#ffffff',
179
- popoverForeground: '#292929',
180
- border: '#DCDEE4',
181
- input: '#DCDEE4',
182
- card: '#FAF9F8',
183
- cardForeground: '#292929',
184
- primary: '#ffffff',
185
- primaryForeground: '#696F8C',
186
- secondary: '#F5F5F5',
187
- secondaryForeground: '#171717',
188
- accent: '#E5F3FF',
189
- accentForeground: '#1D4ED8',
190
- destructive: '#292929',
191
- destructiveForeground: '#FF3363',
192
- ring: '#80849D',
193
- radius: '6px',
174
+ background: "#ffffff",
175
+ foreground: "#292929",
176
+ muted: "#D9D9D9",
177
+ mutedForeground: "#A3A3A3",
178
+ popover: "#ffffff",
179
+ popoverForeground: "#292929",
180
+ border: "#DCDEE4",
181
+ input: "#DCDEE4",
182
+ card: "#FAF9F8",
183
+ cardForeground: "#292929",
184
+ primary: "#ffffff",
185
+ primaryForeground: "#696F8C",
186
+ secondary: "#F5F5F5",
187
+ secondaryForeground: "#171717",
188
+ accent: "#E5F3FF",
189
+ accentForeground: "#1D4ED8",
190
+ destructive: "#292929",
191
+ destructiveForeground: "#FF3363",
192
+ ring: "#80849D",
193
+ radius: "6px",
194
194
  }}
195
195
  />
196
196
  );
@@ -201,23 +201,33 @@ function App() {
201
201
 
202
202
  By default, the Courier Editor auto-saves content. To disable this feature, configure the provider as follows
203
203
 
204
+ _Note:_ `useTemplateActions` _must be used inside of the `<TemplateProvider />` context_
205
+
204
206
  ```tsx
205
207
  import "@trycourier/react-designer/styles.css";
206
- import { TemplateEditor, TemplateProvider, useTemplateActions } from '@trycourier/react-designer';
208
+ import { TemplateEditor, TemplateProvider, useTemplateActions } from "@trycourier/react-designer";
207
209
 
208
210
  function SaveButtonComponent() {
209
211
  const { saveTemplate, publishTemplate } = useTemplateActions();
210
-
211
- const handleSaveTemplate = () => {
212
- //... other publish logic
213
- await saveTemplate(); // the template must be saved before publishing
214
- await publishTemplate();
215
- }
212
+
213
+ const handleSaveTemplate = async () => {
214
+ //... other publish logic
215
+ await saveTemplate(); // the template must be saved before publishing
216
+ await publishTemplate();
217
+ };
216
218
 
217
219
  return (
218
- <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
220
+ <div>
219
221
  <TemplateEditor autoSave={false} hidePublish />
220
- <button onClick={handleSaveTemplate}>Save Template</button>;
222
+ <button onClick={handleSaveTemplate}>Save Template</button>
223
+ </div>
224
+ );
225
+ }
226
+
227
+ function App() {
228
+ return (
229
+ <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
230
+ <SaveButtonComponent />
221
231
  </TemplateProvider>
222
232
  );
223
233
  }
@@ -235,7 +245,7 @@ const courier = new CourierClient({ authorizationToken: "<AUTH_TOKEN>" }); // ge
235
245
  const { requestId } = await courier.send({
236
246
  message: {
237
247
  context: {
238
- tenant_id: "<TENANT_ID>" // The tenant_id should be added to context
248
+ tenant_id: "<TENANT_ID>", // The tenant_id should be added to context
239
249
  },
240
250
  to: {
241
251
  data: {
@@ -243,7 +253,7 @@ const { requestId } = await courier.send({
243
253
  },
244
254
  email: "marty_mcfly@email.com",
245
255
  },
246
- template: "tenant/<TEMPLATE_ID>" // The tenant/ qualifier should be added to the template_id
256
+ template: "tenant/<TEMPLATE_ID>", // The tenant/ qualifier should be added to the template_id
247
257
  },
248
258
  });
249
259
  ```
@@ -256,25 +266,25 @@ The Courier Editor supports nested variable structures:
256
266
 
257
267
  ```tsx
258
268
  import "@trycourier/react-designer/styles.css";
259
- import { TemplateEditor, TemplateProvider } from '@trycourier/react-designer';
269
+ import { TemplateEditor, TemplateProvider } from "@trycourier/react-designer";
260
270
 
261
271
  function App() {
262
272
  return (
263
273
  <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
264
274
  <TemplateEditor
265
275
  variables={{
266
- "user": {
267
- "firstName": "John",
268
- "lastName": "Doe",
269
- "email": "john@example.com"
276
+ user: {
277
+ firstName: "John",
278
+ lastName: "Doe",
279
+ email: "john@example.com",
280
+ },
281
+ company: {
282
+ name: "Acme Inc",
283
+ address: {
284
+ street: "123 Main St",
285
+ city: "San Francisco",
286
+ },
270
287
  },
271
- "company": {
272
- "name": "Acme Inc",
273
- "address": {
274
- "street": "123 Main St",
275
- "city": "San Francisco"
276
- }
277
- }
278
288
  }}
279
289
  />
280
290
  </TemplateProvider>
@@ -295,12 +305,14 @@ The Courier Editor includes a comprehensive error handling system that automatic
295
305
 
296
306
  You can programmatically trigger and handle errors using the `useTemplateActions` hook. This is useful for custom validation, user actions, or integration with external systems.
297
307
 
308
+ _Note: `useTemplateActions` must be used inside of the `<TemplateProvider />` context_
309
+
298
310
  ```tsx
299
- import { useTemplateActions } from '@trycourier/react-designer';
311
+ import { useTemplateActions, TemplateEditor, TemplateProvider } from "@trycourier/react-designer";
300
312
 
301
313
  function CustomComponent() {
302
314
  const { setTemplateError } = useTemplateActions();
303
-
315
+
304
316
  const handleCustomAction = async () => {
305
317
  try {
306
318
  // Your custom logic here
@@ -308,7 +320,7 @@ function CustomComponent() {
308
320
  } catch (error) {
309
321
  // Simple string error (automatically converted)
310
322
  setTemplateError("Something went wrong with your custom action");
311
-
323
+
312
324
  // Or create a structured error with custom toast configuration
313
325
  setTemplateError({
314
326
  message: "Custom error message",
@@ -318,13 +330,26 @@ function CustomComponent() {
318
330
  label: "Retry",
319
331
  onClick: () => handleCustomAction(),
320
332
  },
321
- description: "Additional context about the error"
322
- }
333
+ description: "Additional context about the error",
334
+ },
323
335
  });
324
336
  }
325
337
  };
326
338
 
327
- return <button onClick={handleCustomAction}>Custom Action</button>;
339
+ return (
340
+ <div>
341
+ <TemplateEditor />
342
+ <button onClick={handleCustomAction}>Custom Action</button>
343
+ </div>
344
+ );
345
+ }
346
+
347
+ function App() {
348
+ return (
349
+ <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
350
+ <CustomComponent />
351
+ </TemplateProvider>
352
+ );
328
353
  }
329
354
  ```
330
355
 
@@ -335,8 +360,8 @@ All errors use a simple, consistent structure:
335
360
  ```tsx
336
361
  // Error interface
337
362
  interface TemplateError {
338
- message: string; // The error message to display
339
- toastProps?: ExternalToast; // Optional Sonner toast configuration
363
+ message: string; // The error message to display
364
+ toastProps?: ExternalToast; // Optional Sonner toast configuration
340
365
  }
341
366
 
342
367
  // Usage examples
@@ -348,8 +373,8 @@ setTemplateError({
348
373
  action: {
349
374
  label: "Try Again",
350
375
  onClick: () => retryUpload(),
351
- }
352
- }
376
+ },
377
+ },
353
378
  });
354
379
 
355
380
  // Different error scenarios
@@ -362,18 +387,25 @@ setTemplateError({ message: "Validation error", toastProps: { duration: 5000 } }
362
387
 
363
388
  The editor includes an error boundary component to catch and handle React rendering errors gracefully.
364
389
 
365
- ```tsx
366
- import { ErrorBoundary, useTemplateActions } from '@trycourier/react-designer';
390
+ _Note: `useTemplateActions` must be used inside of the `<TemplateProvider />` context_
367
391
 
368
- function App() {
392
+ ```tsx
393
+ import {
394
+ ErrorBoundary,
395
+ useTemplateActions,
396
+ TemplateEditor,
397
+ TemplateProvider,
398
+ } from "@trycourier/react-designer";
399
+
400
+ function TemplateEditorWithErrorHandling() {
369
401
  const { setTemplateError } = useTemplateActions();
370
-
402
+
371
403
  return (
372
- <ErrorBoundary
404
+ <ErrorBoundary
373
405
  onError={(error, errorInfo) => {
374
406
  // Custom error logging
375
- console.error('Editor error:', error);
376
-
407
+ console.error("Editor error:", error);
408
+
377
409
  // Optional: integrate with template error system
378
410
  setTemplateError({
379
411
  message: `Render error: ${error.message}`,
@@ -383,35 +415,64 @@ function App() {
383
415
  label: "Reload",
384
416
  onClick: () => window.location.reload(),
385
417
  },
386
- }
418
+ },
387
419
  });
388
420
  }}
389
421
  fallback={<div>Something went wrong. Please refresh the page.</div>}
390
422
  >
391
- <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
392
- <TemplateEditor />
393
- </TemplateProvider>
423
+ <TemplateEditor />
394
424
  </ErrorBoundary>
395
425
  );
396
426
  }
427
+
428
+ function App() {
429
+ return (
430
+ <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
431
+ <TemplateEditorWithErrorHandling />
432
+ </TemplateProvider>
433
+ );
434
+ }
397
435
  ```
398
436
 
399
437
  ### Clearing Errors
400
438
 
401
439
  To programmatically clear the current error state:
402
440
 
441
+ _Note: `useTemplateActions` must be used inside of the `<TemplateProvider />` context_
442
+
403
443
  ```tsx
404
- const { setTemplateError } = useTemplateActions();
444
+ import { useTemplateActions, TemplateEditor, TemplateProvider } from "@trycourier/react-designer";
405
445
 
406
- // Clear the error
407
- setTemplateError(null);
446
+ function ClearErrorComponent() {
447
+ const { setTemplateError } = useTemplateActions();
448
+
449
+ const handleClearError = () => {
450
+ // Clear the error
451
+ setTemplateError(null);
452
+ };
453
+
454
+ return (
455
+ <div>
456
+ <TemplateEditor />
457
+ <button onClick={handleClearError}>Clear Error</button>
458
+ </div>
459
+ );
460
+ }
461
+
462
+ function App() {
463
+ return (
464
+ <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
465
+ <ClearErrorComponent />
466
+ </TemplateProvider>
467
+ );
468
+ }
408
469
  ```
409
470
 
410
471
  ## Brand Editor
411
472
 
412
473
  The Brand Editor component allows you to customize and manage a tenant's brand settings directly within your application. This specialized editor provides an interface for modifying brand colors, logos, and other visual elements that will be applied to your templates.
413
474
 
414
- *Note: For successful authentication it's required to generate a JWT with proper [brand scopes](#scopes).*
475
+ _Note: For successful authentication it's required to generate a JWT with proper [brand scopes](#scopes)._
415
476
 
416
477
  ### Basic
417
478
 
@@ -419,7 +480,7 @@ Similar to the basic Template Editor setup, implementing the Brand Editor requir
419
480
 
420
481
  ```tsx
421
482
  import "@trycourier/react-designer/styles.css";
422
- import { BrandEditor, BrandProvider } from '@trycourier/react-designer';
483
+ import { BrandEditor, BrandProvider } from "@trycourier/react-designer";
423
484
 
424
485
  function App() {
425
486
  return (
@@ -434,19 +495,19 @@ function App() {
434
495
 
435
496
  Similar to the Template Editor, the Brand Editor also provides a publishing hook that allows you to customize the publishing behavior. You can use the `useBrandActions` hook to programmatically trigger brand updates and integrate them with your application's workflow.
436
497
 
437
- *Note: `useBrandActions` must be used inside of the `<BrandProvider />` context*
498
+ _Note: `useBrandActions` must be used inside of the `<BrandProvider />` context_
438
499
 
439
500
  ```tsx
440
501
  import "@trycourier/react-designer/styles.css";
441
- import { BrandEditor, BrandProvider, useBrandActions } from '@trycourier/react-designer';
502
+ import { BrandEditor, BrandProvider, useBrandActions } from "@trycourier/react-designer";
442
503
 
443
504
  function SaveBrandComponent() {
444
505
  const { publishBrand } = useBrandActions();
445
-
506
+
446
507
  const handlePublishBrand = () => {
447
- //... other publish logic
448
- await publishBrand();
449
- }
508
+ //... other publish logic
509
+ await publishBrand();
510
+ };
450
511
 
451
512
  return (
452
513
  <BrandProvider tenantId="tenant-123" token="jwt | client key">
@@ -463,7 +524,7 @@ The `@trycourier/react-designer` package allows you to use both the Brand Editor
463
524
 
464
525
  ```tsx
465
526
  import "@trycourier/react-designer/styles.css";
466
- import { TemplateEditor, TemplateProvider } from '@trycourier/react-designer';
527
+ import { TemplateEditor, TemplateProvider } from "@trycourier/react-designer";
467
528
 
468
529
  function App() {
469
530
  return (
@@ -476,7 +537,7 @@ function App() {
476
537
 
477
538
  `TemplaeProvider` supports the both editors – there is no need to add `BrandProvider` in this mode.
478
539
 
479
- *Note: The JWT token must include proper [scopes](#scopes) for both template and brand editing capabilities.*
540
+ _Note: The JWT token must include proper [scopes](#scopes) for both template and brand editing capabilities._
480
541
 
481
542
  # Properties
482
543
 
@@ -486,51 +547,83 @@ The Properties section details the configuration options available for both the
486
547
 
487
548
  The Editor component is the core element that provides the template editing interface. If you are using the Template Editor with the Template provider, required properties will be provided.
488
549
 
489
- | Property | Type | Default | Description |
490
- | --- | --- | --- | --- |
491
- | autoSave | boolean | true | Enables automatic saving of changes to the template. When true, changes are automatically persisted. |
492
- | autoSaveDebounce | number | 200ms | Time in milliseconds to wait after changes before triggering an auto-save operation. Controls save frequency. |
493
- | brandEditor | boolean | false | When enabled, shows the brand editor interface alongside the template editor. Allows editing brand settings. |
494
- | brandProps | BrandEditorProps | | Configuration options for the brand editor when enabled. Passed directly to the BrandEditor component. |
495
- | hidePublish | boolean | false | When true, hides the "Publish Changes" button in the editor interface. |
496
- | onChange | (value: ElementalContent) => void | | Callback function that fires whenever the editor content changes, providing the updated ElementalContent structure. |
497
- | routing | { method: string; channels: string[] } | | Configures multi-channel routing behavior. The `method` property determines how channels are selected: "single" (send to the first channel) or "all" (send to all channels). The `channels` array specifies available delivery channels like ["email", "sms", "push"]. |
498
- | theme | ThemeObj | cssClass | | Controls the visual appearance of the editor. Can be a Theme object with styling properties or a CSS class name. |
499
- | value | ElementalContent | | Initial content for the editor in ElementalContent format. Used as the starting template when the editor loads. |
500
- | variables | Record<string, any | | Custom variables available for template personalization. These can be referenced within the template content. |
550
+ | Property | Type | Default | Description |
551
+ | ---------------- | -------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
552
+ | autoSave | boolean | true | Enables automatic saving of changes to the template. When true, changes are automatically persisted. |
553
+ | autoSaveDebounce | number | 200ms | Time in milliseconds to wait after changes before triggering an auto-save operation. Controls save frequency. |
554
+ | brandEditor | boolean | false | When enabled, shows the brand editor interface alongside the template editor. Allows editing brand settings. |
555
+ | brandProps | BrandEditorProps | | Configuration options for the brand editor when enabled. Passed directly to the BrandEditor component. |
556
+ | hidePublish | boolean | false | When true, hides the "Publish Changes" button in the editor interface. |
557
+ | onChange | (value: ElementalContent) => void | | Callback function that fires whenever the editor content changes, providing the updated ElementalContent structure. |
558
+ | routing | { method: string; channels: string[] } | | Configures multi-channel routing and delivery behavior. The `method` property determines delivery strategy: "single" (deliver via first available channel) or "all" (deliver via all configured channels). The `channels` array defines which delivery channels are available in the editor. |
559
+ | theme | ThemeObj | cssClass | | Controls the visual appearance of the editor. Can be a Theme object with styling properties or a CSS class name. |
560
+ | value | ElementalContent | | Initial content for the editor in ElementalContent format. Used as the starting template when the editor loads. |
561
+ | variables | Record<string, any | | Custom variables available for template personalization. These can be referenced within the template content. |
562
+
563
+ ### Multi-Channel Routing
564
+
565
+ The `routing` property allows you to configure which communication channels are available in the template editor and how messages are delivered to recipients. This gives you full control over the delivery strategy for your templates.
566
+
567
+ ```tsx
568
+ import "@trycourier/react-designer/styles.css";
569
+ import { TemplateEditor, TemplateProvider } from "@trycourier/react-designer";
570
+
571
+ function App() {
572
+ return (
573
+ <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
574
+ <TemplateEditor
575
+ routing={{
576
+ method: "single", // "single" for fallback delivery, "all" for simultaneous delivery
577
+ channels: ["email", "sms", "push"] // Available channels in the editor
578
+ }}
579
+ />
580
+ </TemplateProvider>
581
+ );
582
+ }
583
+ ```
584
+
585
+ **Channel Options:**
586
+ - `"email"` - Email delivery
587
+ - `"sms"` - SMS text messaging
588
+ - `"push"` - Push notifications
589
+ - `"inbox"` - In-app messaging
590
+
591
+ **Delivery Methods:**
592
+ - `"single"` - Delivers via the first available channel (fallback strategy)
593
+ - `"all"` - Delivers via all configured channels simultaneously
501
594
 
502
595
  ### Template Provider Properties
503
596
 
504
- The TemplateProvider component wraps the Editor component and manages the template state, authentication, and data flow. It provides essential context and functionality needed for the editor to operate. Below are the key properties that can be configured when using the
597
+ The TemplateProvider component wraps the Editor component and manages the template state, authentication, and data flow. It provides essential context and functionality needed for the editor to operate. Below are the key properties that can be configured when using the
505
598
 
506
- | Property | Type | Required | Description |
507
- | --- | --- | --- | --- |
508
- | templateId | string | Yes | Unique identifier for the template being edited. Required for loading and saving template data. If the template with that ID has not been created yet, it will be on the first save. |
509
- | tenantId | string | Yes | The tenant ID associated with the template. Used for brand theming and tenant-specific functionality. |
510
- | token | string | Yes | Authentication token (JWT or ClientKey) used to authorize API requests to Courier services. |
599
+ | Property | Type | Required | Description |
600
+ | ---------- | ------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
601
+ | templateId | string | Yes | Unique identifier for the template being edited. Required for loading and saving template data. If the template with that ID has not been created yet, it will be on the first save. |
602
+ | tenantId | string | Yes | The tenant ID associated with the template. Used for brand theming and tenant-specific functionality. |
603
+ | token | string | Yes | Authentication token (JWT or ClientKey) used to authorize API requests to Courier services. |
511
604
 
512
605
  ### Brand Editor
513
606
 
514
607
  The Brand Editor component accepts properties that allow you to customize its behavior and appearance. These properties provide control over the editing interface and functionality specific to brand management.
515
608
 
516
- | Property | Type | Default | Description |
517
- | --- | --- | --- | --- |
518
- | autoSave | boolean | true | Enables automatic saving of changes to the template. When true, changes are automatically persisted. |
519
- | autoSaveDebounce | number | 200ms | Time in milliseconds to wait after changes before triggering an auto-save operation. Controls save frequency. |
520
- | hidePublish | boolean | false | When true, hides the "Publish Changes" button in the editor interface. |
521
- | onChange | (value: BrandSettings) => void | | Callback function that fires whenever brand settings are modified, providing the updated brand configuration values. |
522
- | theme | ThemeObj | cssClass | | Controls the visual appearance of the editor. Can be a Theme object with styling properties or a CSS class name. |
523
- | value | BrandSettings | | Initial brand settings values to populate the editor with, including colors, logo, social links, and header style preferences. |
524
- | variables | Record<string, any | | Custom variables available for brand personalization. These can be referenced within the brand footer content. |
609
+ | Property | Type | Default | Description |
610
+ | ---------------- | ------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
611
+ | autoSave | boolean | true | Enables automatic saving of changes to the template. When true, changes are automatically persisted. |
612
+ | autoSaveDebounce | number | 200ms | Time in milliseconds to wait after changes before triggering an auto-save operation. Controls save frequency. |
613
+ | hidePublish | boolean | false | When true, hides the "Publish Changes" button in the editor interface. |
614
+ | onChange | (value: BrandSettings) => void | | Callback function that fires whenever brand settings are modified, providing the updated brand configuration values. |
615
+ | theme | ThemeObj | cssClass | | Controls the visual appearance of the editor. Can be a Theme object with styling properties or a CSS class name. |
616
+ | value | BrandSettings | | Initial brand settings values to populate the editor with, including colors, logo, social links, and header style preferences. |
617
+ | variables | Record<string, any | | Custom variables available for brand personalization. These can be referenced within the brand footer content. |
525
618
 
526
619
  ### Brand Provider
527
620
 
528
621
  The Brand Provider component is responsible for managing brand-related state and context in your application. It wraps the Brand Editor component and handles data flow, authentication, and state management for brand customization. Here are the key properties that can be configured:
529
622
 
530
- | Property | Type | Required | Description |
531
- | --- | --- | --- | --- |
532
- | tenantId | string | Yes | The unique identifier for the tenant whose brand settings are being edited. |
533
- | token | string | Yes | Authentication token (JWT or ClientKey) used to authorize brand-related API requests. |
623
+ | Property | Type | Required | Description |
624
+ | -------- | ------ | -------- | ------------------------------------------------------------------------------------- |
625
+ | tenantId | string | Yes | The unique identifier for the tenant whose brand settings are being edited. |
626
+ | token | string | Yes | Authentication token (JWT or ClientKey) used to authorize brand-related API requests. |
534
627
 
535
628
  # Limitations
536
629
 
@@ -569,6 +662,7 @@ This package can be published to npm using the provided scripts. The publishing
569
662
  - `pnpm release:canary` - Creates a canary release with a unique tag
570
663
 
571
664
  The release script will:
665
+
572
666
  - Check if your working directory is clean
573
667
  - Build the package
574
668
  - Run tests
@@ -584,11 +678,13 @@ Canary builds are pre-release versions that allow users to test the latest chang
584
678
  #### Creating a canary build
585
679
 
586
680
  Run the canary release command:
681
+
587
682
  ```sh
588
683
  pnpm release:canary
589
684
  ```
590
685
 
591
686
  This will:
687
+
592
688
  - Generate a unique tag in the format `canary-{timestamp}`
593
689
  - Create a version like `0.0.1-canary-1718392847`
594
690
  - Publish to npm with the unique tag
@@ -596,11 +692,13 @@ This will:
596
692
  #### Installing a specific canary build
597
693
 
598
694
  To see all available canary builds:
695
+
599
696
  ```sh
600
697
  npm dist-tag ls @trycourier/courier-designer
601
698
  ```
602
699
 
603
700
  To install a specific canary build:
701
+
604
702
  ```sh
605
703
  # Example for a specific canary build
606
704
  npm install @trycourier/courier-designer@canary-1718392847